<?php

namespace App\Models;

use App\Admin\Traits\AdminBuilder;
use App\Admin\Traits\CanValidate;
use Spatie\Permission\Models\Role as Ro;

class Role extends Ro
{
    use CanValidate;
    use AdminBuilder;

    protected $fillable = ['name', 'display_name', 'guard_name',];

    public function validateRules()
    {
        return [
            'name'         => 'required|max:50|unique:roles,name,' . (int)$this->id,
            'display_name' => 'required|max:50|unique:roles,display_name,' . (int)$this->id,
        ];
    }

    public function validateMessages()
    {
        return [];
    }

    public function validateAttributes()
    {
        return [
            'name'         => '角色标志',
            'display_name' => '角色名',
        ];
    }
}
